/**
 * 
 * 将两个有序列表合并成一个有序列表 (增量排序)
 * @param {*} listA 有序表A
 * @param {*} listB 有序表B
 */
function merge (listA, listB) {
    let a = 0,b = 0,res = [],lengthA = listA.length,lengthB = listB.length
    while (a < lengthA && b < lengthB) {
        if (listA[a] <= listB[b]) {
            res.push(listA[a])
            a++
        } else {
            res.push(listB[b])
            b++
        }
    }

    while (a < lengthA) {
        res.push(listA[a++])
    }

    while (b < lengthB) {
        res.push(listB[b++])
    }
    return res
}


console.log(merge([0,2,4,6,8,10,12], [1,3,5,7,9,11]))